import * as React from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
// import createBrowserHistory from 'history/createBrowserHistory';


//按需加载 路由插件
// import asyncComponent from './asyncComponent'

//按需加载的组件
let Home = React.lazy(() => import('../pages/home/home'));



//生成一个实例对象 历史记录什么的
// const history = createBrowserHistory();
class RouterMap extends React.Component {
  constructor(props:any) {
    super(props);
  }
  render() {
    return (
      // <Router history={history}>
      <Router>
        <Switch>
            <React.Suspense fallback={<div>Loading...</div>}>
              <Route exact path="/" component={Home} />
              {/* <Route path="/home/:city" component={Home} />
              <Route path="/localCitys" component={LocalCitys} />
              <Route path="/goodDetails/:id" component={GoodDetails} />
              <Route path="/users" component={Users} /> */}
            </React.Suspense>
        </Switch>
      </Router>
    );
  }
}

//返回了 connect 其实是一个容器组件
export default RouterMap; 
